﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefProdTransSn" :model="stateProdTransSn.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Sn_FormItem" prop="Entity.Sn" :label="$t('message.autotrans._Model_ProdTransSn_Sn')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_Sn')}), trigger: 'blur' }]" >
            <el-input v-model="stateProdTransSn.vmModel.Entity.Sn" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ProductId_FormItem" prop="Entity.ProductId" :label="$t('message.autotrans._Model_ProdTransSn_ProductId')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.ProductId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ProductCode_FormItem" prop="Entity.ProductCode" :label="$t('message.autotrans._Model_ProdTransSn_ProductCode')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.ProductCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Wo_FormItem" prop="Entity.Wo" :label="$t('message.autotrans._Model_ProdTransSn_Wo')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.Wo" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CurLineId_FormItem" prop="Entity.CurLineId" :label="$t('message.autotrans._Model_ProdTransSn_CurLineId')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.CurLineId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CurLineCode_FormItem" prop="Entity.CurLineCode" :label="$t('message.autotrans._Model_ProdTransSn_CurLineCode')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.CurLineCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CurOpId_FormItem" prop="Entity.CurOpId" :label="$t('message.autotrans._Model_ProdTransSn_CurOpId')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_CurOpId')}), trigger: 'blur' }]" >
            <el-input v-model="stateProdTransSn.vmModel.Entity.CurOpId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CurOpCode_FormItem" prop="Entity.CurOpCode" :label="$t('message.autotrans._Model_ProdTransSn_CurOpCode')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.CurOpCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CurRoutingId_FormItem" prop="Entity.CurRoutingId" :label="$t('message.autotrans._Model_ProdTransSn_CurRoutingId')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.CurRoutingId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CurRoutingCode_FormItem" prop="Entity.CurRoutingCode" :label="$t('message.autotrans._Model_ProdTransSn_CurRoutingCode')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.CurRoutingCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_InboundTime_FormItem" prop="Entity.InboundTime" :label="$t('message.autotrans._Model_ProdTransSn_InboundTime')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_InboundTime')}), trigger: 'blur' }]" >
            <el-input v-model="stateProdTransSn.vmModel.Entity.InboundTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OutboundTime_FormItem" prop="Entity.OutboundTime" :label="$t('message.autotrans._Model_ProdTransSn_OutboundTime')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.OutboundTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OnlineTime_FormItem" prop="Entity.OnlineTime" :label="$t('message.autotrans._Model_ProdTransSn_OnlineTime')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_OnlineTime')}), trigger: 'blur' }]" >
            <el-input v-model="stateProdTransSn.vmModel.Entity.OnlineTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OfflineTime_FormItem" prop="Entity.OfflineTime" :label="$t('message.autotrans._Model_ProdTransSn_OfflineTime')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.OfflineTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Stage_FormItem" prop="Entity.Stage" :label="$t('message.autotrans._Model_ProdTransSn_Stage')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_Stage')}), trigger: 'blur' }]" >
            <el-select v-model="stateProdTransSn.vmModel.Entity.Stage" disabled clearable>
               <el-option key="Inbound" value="Inbound" :label="$t('message.autotrans._Enum_SnStageEnum_Inbound')"></el-option>
               <el-option key="Outbound" value="Outbound" :label="$t('message.autotrans._Enum_SnStageEnum_Outbound')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Status_FormItem" prop="Entity.Status" :label="$t('message.autotrans._Model_ProdTransSn_Status')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_Status')}), trigger: 'blur' }]" >
            <el-select v-model="stateProdTransSn.vmModel.Entity.Status" disabled clearable>
               <el-option key="OK" value="OK" :label="$t('message.autotrans._Enum_SnStatusEnum_OK')"></el-option>
               <el-option key="NG" value="NG" :label="$t('message.autotrans._Enum_SnStatusEnum_NG')"></el-option>
               <el-option key="MandatoryOK" value="MandatoryOK" :label="$t('message.autotrans._Enum_SnStatusEnum_MandatoryOK')"></el-option>
               <el-option key="MandatoryNG" value="MandatoryNG" :label="$t('message.autotrans._Enum_SnStatusEnum_MandatoryNG')"></el-option>
               <el-option key="Scrap" value="Scrap" :label="$t('message.autotrans._Enum_SnStatusEnum_Scrap')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsCompelted_FormItem" prop="Entity.IsCompelted" :label="$t('message.autotrans._Model_ProdTransSn_IsCompelted')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_IsCompelted')}), trigger: 'blur' }]" >
            <el-input v-model="stateProdTransSn.vmModel.Entity.IsCompelted" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CustomerSn_FormItem" prop="Entity.CustomerSn" :label="$t('message.autotrans._Model_ProdTransSn_CustomerSn')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.CustomerSn" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ReworkFlag_FormItem" prop="Entity.ReworkFlag" :label="$t('message.autotrans._Model_ProdTransSn_ReworkFlag')">
            <el-select v-model="stateProdTransSn.vmModel.Entity.ReworkFlag" disabled clearable>
               <el-option key="None" value="None" :label="$t('message.autotrans._Enum_ReworkFlagEnum_None')"></el-option>
               <el-option key="Wait" value="Wait" :label="$t('message.autotrans._Enum_ReworkFlagEnum_Wait')"></el-option>
               <el-option key="Working" value="Working" :label="$t('message.autotrans._Enum_ReworkFlagEnum_Working')"></el-option>
               <el-option key="Done" value="Done" :label="$t('message.autotrans._Enum_ReworkFlagEnum_Done')"></el-option>
               <el-option key="DoneAndWaitToRelaunch" value="DoneAndWaitToRelaunch" :label="$t('message.autotrans._Enum_ReworkFlagEnum_DoneAndWaitToRelaunch')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ReworkDoc_FormItem" prop="Entity.ReworkDoc" :label="$t('message.autotrans._Model_ProdTransSn_ReworkDoc')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.ReworkDoc" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ReworkCount_FormItem" prop="Entity.ReworkCount" :label="$t('message.autotrans._Model_ProdTransSn_ReworkCount')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_ReworkCount')}), trigger: 'blur' }]" >
            <el-input v-model="stateProdTransSn.vmModel.Entity.ReworkCount" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_NgSteps_FormItem" prop="Entity.NgSteps" :label="$t('message.autotrans._Model_ProdTransSn_NgSteps')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.NgSteps" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsNeedRework_FormItem" prop="Entity.IsNeedRework" :label="$t('message.autotrans._Model_ProdTransSn_IsNeedRework')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_IsNeedRework')}), trigger: 'blur' }]" >
            <el-input v-model="stateProdTransSn.vmModel.Entity.IsNeedRework" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CreateTime_FormItem" prop="Entity.CreateTime" :label="$t('message.autotrans._Model_ProdTransSn_CreateTime')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.CreateTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UpdateTime_FormItem" prop="Entity.UpdateTime" :label="$t('message.autotrans._Model_ProdTransSn_UpdateTime')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.UpdateTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CreateBy_FormItem" prop="Entity.CreateBy" :label="$t('message.autotrans._Model_ProdTransSn_CreateBy')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.CreateBy" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UpdateBy_FormItem" prop="Entity.UpdateBy" :label="$t('message.autotrans._Model_ProdTransSn_UpdateBy')">
            <el-input v-model="stateProdTransSn.vmModel.Entity.UpdateBy" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsValid_FormItem" prop="Entity.IsValid" :label="$t('message.autotrans._Model_ProdTransSn_IsValid')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_ProdTransSn_IsValid')}), trigger: 'blur' }]" >
            <el-input v-model="stateProdTransSn.vmModel.Entity.IsValid" disabled clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onCloseProdTransSn"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageProductionManagementProdTransSnDetails;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { prodtranssnApi } from '/@/api/productionmanagement/prodtranssn';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefProdTransSn = ref();
const stateProdTransSn = reactive({
    vmModel: {
	  Entity:{
        Sn: '',
        ProductId: null,
        ProductCode: '',
        Wo: '',
        CurLineId: null,
        CurLineCode: '',
        CurOpId: null,
        CurOpCode: '',
        CurRoutingId: null,
        CurRoutingCode: '',
        InboundTime: undefined,
        OutboundTime: undefined,
        OnlineTime: undefined,
        OfflineTime: undefined,
        Stage: undefined,
        Status: undefined,
        IsCompelted: undefined,
        CustomerSn: '',
        ReworkFlag: undefined,
        ReworkDoc: '',
        ReworkCount: null,
        NgSteps: '',
        IsNeedRework: undefined,
        CreateTime: undefined,
        UpdateTime: undefined,
        CreateBy: '',
        UpdateBy: '',
        IsValid: undefined,
        ID:null,
      },

	},
    
});

// 取消
const onCloseProdTransSn = () => {
    closeDialog();
};

// 提交
const onSubmitProdTransSn = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefProdTransSn.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            prodtranssnApi().edit(stateProdTransSn.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
        else{
			loadingInstance.close();
        }
	})
};

// 页面加载时
onMounted(() => {
    
    if (ci.attrs["wtmdata"]) {
		stateProdTransSn.vmModel.Entity.ID = ci.attrs["wtmdata"].ID;
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateProdTransSn.vmModel.Entity.ID = useRouter().currentRoute.value.query.id as any;
	}
	prodtranssnApi().get(stateProdTransSn.vmModel.Entity.ID ?? "").then((data: any) => other.setValue(stateProdTransSn.vmModel, data));
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

